package com.swipemaster;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.view.MotionEvent;
import android.widget.TextView;

class TouchSurfaceView extends GLSurfaceView
{
    private GameRenderer mRenderer;
    private TextView mTextView;
    
    public TouchSurfaceView(Context context, int width, int height, TextView textView)
    {
        super(context);
        mTextView = textView;
        mRenderer = new GameRenderer(this, width, height);
        setRenderer(mRenderer);
        setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    }

    @Override
    public boolean onTouchEvent(MotionEvent e)
    {
    	int x = (int) e.getX();
    	int y = (int) e.getY();
    	mRenderer.addSquare(x, y);
    	mTextView.setText(mRenderer.getNumberOfEnemies() + "");
    	requestRender();
        return true;
    }
    
}